import request from '@/config/axios'

// ERP仓库管理-成品入库单主 VO
export interface StockFinishedGoodsInboundVO {
  id: string // 入库单ID
  inboundNo: string // 入库单号码
  warehouseId: string // 仓库ID
  warehouseName: string // 仓库名称
  productionTeamId: string // 生产班组ID
  productionTeamName: string // 生产班组名称
  machineId: string // 机台ID
  machineName: string // 机台名称
  inventoryDate: Date // 入库日期
  isApproved: boolean // 审核
  approver: string // 审核人
  approveTime: Date // 审核时间
  isPrinted: boolean // 打印
  isInitial: boolean // 期初
  remark: string // 备注
}

// ERP仓库管理-成品入库单主 API
export const StockFinishedGoodsInboundApi = {
  // 查询ERP仓库管理-成品入库单主分页
  getStockFinishedGoodsInboundPage: async (params: any) => {
    return await request.get({ url: `/erp/stock-finished-goods-inbound/page`, params })
  },

  // 查询ERP仓库管理-成品入库单主详情
  getStockFinishedGoodsInbound: async (id: number) => {
    return await request.get({ url: `/erp/stock-finished-goods-inbound/get?id=` + id })
  },

  // 新增ERP仓库管理-成品入库单主
  createStockFinishedGoodsInbound: async (data: StockFinishedGoodsInboundVO) => {
    return await request.post({ url: `/erp/stock-finished-goods-inbound/create`, data })
  },

  // 修改ERP仓库管理-成品入库单主
  updateStockFinishedGoodsInbound: async (data: StockFinishedGoodsInboundVO) => {
    return await request.put({ url: `/erp/stock-finished-goods-inbound/update`, data })
  },

  // 删除ERP仓库管理-成品入库单主
  deleteStockFinishedGoodsInbound: async (id: number) => {
    return await request.delete({ url: `/erp/stock-finished-goods-inbound/delete?id=` + id })
  },

  // 导出ERP仓库管理-成品入库单主 Excel
  exportStockFinishedGoodsInbound: async (params) => {
    return await request.download({ url: `/erp/stock-finished-goods-inbound/export-excel`, params })
  },

// ==================== 子表（ERP仓库管理-成品入库单子） ====================

  // 获得ERP仓库管理-成品入库单子分页
  getStockFinishedGoodsInboundDetailPage: async (params) => {
    return await request.get({ url: `/erp/stock-finished-goods-inbound/stock-finished-goods-inbound-detail/page`, params })
  },
  // 新增ERP仓库管理-成品入库单子
  createStockFinishedGoodsInboundDetail: async (data) => {
    return await request.post({ url: `/erp/stock-finished-goods-inbound/stock-finished-goods-inbound-detail/create`, data })
  },

  // 修改ERP仓库管理-成品入库单子
  updateStockFinishedGoodsInboundDetail: async (data) => {
    return await request.put({ url: `/erp/stock-finished-goods-inbound/stock-finished-goods-inbound-detail/update`, data })
  },

  // 删除ERP仓库管理-成品入库单子
  deleteStockFinishedGoodsInboundDetail: async (id: number) => {
    return await request.delete({ url: `/erp/stock-finished-goods-inbound/stock-finished-goods-inbound-detail/delete?id=` + id })
  },

  // 获得ERP仓库管理-成品入库单子
  getStockFinishedGoodsInboundDetail: async (id: number) => {
    return await request.get({ url: `/erp/stock-finished-goods-inbound/stock-finished-goods-inbound-detail/get?id=` + id })
  }
}